package com.xncoding.valid.Aware;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
public class MyApplicationEventPublisherAware implements ApplicationEventPublisherAware {
    private ApplicationEventPublisher eventPublisher;

    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher eventPublisher) {
        this.eventPublisher = eventPublisher;
    }

    // 其他业务方法，可以在其中使用 eventPublisher 发布事件
    // 假设有一个自定义事件类 MyCustomEvent 继承自 ApplicationEvent
    public void publishCustomEvent() {
//        MyCustomEvent event = new MyCustomEvent(this, "some data");
//        eventPublisher.publishEvent(event);
    }
}
